You can use the GetComponentInfo function to retrieve information about a component, including the component name, icon, and other information. Listing 3 shows an application-defined procedure that retrieves information about a video digitizer component.
Listing 3 Getting information about a component
PROCEDURE MyGetCompInfo (compName, compInfo, compIcon: Handle;
VAR videoDesc: ComponentDescription);
VAR
videoCompID: Component;
myErr: OSErr;
BEGIN
{first find a video digitizer component}
MyFindVideoComponent(videoCompID);
{now get information about it}
IF videoCompID <> NIL THEN
myErr := GetComponentInfo(videoCompID, videoDesc, compName,
compInfo, compIcon);
END;
You specify the component in the first parameter to GetComponentInfo . You specify the component using either a component identifier (obtained from FindNextComponent or RegisterComponent ) or a component instance (obtained from OpenDefaultComponent or OpenComponent ).
The GetComponentInfo function returns information about the component in the second through fifth parameters of the function. The GetComponentInfo function returns information about the component (such as its type, subtype, and manufacturer) in a component description record. The function also returns the component name, icon, and other information through handles. You must allocate these handles before calling GetComponentInfo . (Alternatively, you can specify NIL in the compName , compInfo , and compIcon parameters if you do not want the information returned.) The icon returned in the compIcon parameter is a handle to a black-and-white icon. If a component has an icon family, you can retrieve a handle to its icon suite using GetComponentIconSuite .